#include<iostream>
#include<cstring>
#include<cmath>
using namespace std;
class Point
{
    private:
        double x,y;
    public:
        Point(double x_value=0,double y_value=0):x(x_value),y(y_value)
        { 
            cout<<"Constructor."<<endl;
        }
        void SetPoint(double _x,double _y)
        {
            x=_x;
            y=_y;
        }
        double getX()const
        {
            return x;
        }
        double getY()const
        {
            return y;
        }
        double getDisTo(const Point& p);
        ~Point()
        {
            cout<<"Distructor."<<endl;
        }
};

double Point::getDisTo(const Point& p)
{
    return sqrt((x-p.getX())*(x-p.getX())+(y-p.getY())*(y-p.getY()));
}

int main()
{
    int time;
    cin>>time;
    while(time--)
    {
        int N;
        cin>>N;
        Point* array=new Point[N];
        for(int i=0;i<N;i++)
        {
            int ap,aq;
            cin>>ap>>aq;
            array[i].SetPoint(ap,aq);
        }
        double maxLen=array[0].getDisTo(array[1]);
        int Maxi=0,Maxj=1;
        //两两比较，On2
        for(int i=0;i<N-1;i++)
        {
            for(int j=i+1;j<N;j++)
            {
                double tmp=array[i].getDisTo(array[j]);
                if(tmp>maxLen)
                {
                    maxLen=tmp;
                    Maxi=i;
                    Maxj=j;
                }
            }
        }
        printf("The longeset distance is %.2f,between p[%d] and p[%d].\n",maxLen,Maxi,Maxj);
        delete[] array;
    }
}